package data;

public class Cities {
    private int n;
    private Point[] cities;

    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
        cities = new Point[n + 1];
    }

    public Point[] getCities() {
        return cities;
    }

    public void setCities(Point[] cities) {
        this.cities = cities;
    }

    public void setCity(int i, double x, double y) {
        cities[i] = new Point(x, y);
    }
    
    public Point getCity(int i) {
        return cities[i];
    }
    
    public double distance(int i, int j) {
        return Math.pow(Math.pow(cities[i].getX() - cities[j].getX(), 2.0) + Math.pow(cities[i].getY() - cities[j].getY(), 2.0), 0.5);        
    }

    @SuppressWarnings("unused")
    private double distance(Point u, Point v) {
        return Math.pow(Math.pow(u.getX()-v.getX(), 2.0) + Math.pow(u.getY()-v.getY(), 2.0), 0.5);
    }
}
